<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja" id="main">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>WebAudio 类</title>
	<link rel="stylesheet" href="../inc/css/style.min.css" />
	<script type="text/javascript" src="../inc/js/lib/jquery-1.11.1.min.js"></script>
	<script type="text/javascript" src="../inc/js/common.js"></script>
</head>
<body>

	<div class="main">

		<h1 class="main__title--h1 main__title--h1--v07">WebAudio 类</h1>
		<ul class="breadcrumb">
			<li>JS 库</li>
			<li>&gt;</li>
			<li>WebAudio 类</li>
		</ul>
		<p>使用 Web Audio API 的音频对象。</p>
		<div class="main__section">
			<h2 class="main__title--h2">构造函数</h2>
<pre class="main__pre--code">
WebAudio ( url )
</pre>
			<div class="params">
				<h4>参数：</h4>

				<ul class="params-list">
					<li class="param">
						<code class="param-name">url</code>
						<span class="type">String</span>
						<div class="param-description">
							<p>音频文件的地址</p>
						</div>
					</li>
				</ul>
			</div>
		</div><!-- /main__section -->



		<div class="main__section">
			<h2 class="main__title--h2">索引</h2>
			<b>方法</b>
			<ul class="main__ul--inline">
				<li><a href="#m01">addLoadListener</a></li>
				<li><a href="#m02">addStopListener</a></li>
				<li><a href="#m03">canPlayM4a</a> <span>static</span></li>
				<li><a href="#m04">canPlayOgg</a> <span>static</span></li>
				<li><a href="#m05">clear</a></li>
				<li><a href="#m06">fadeIn</a></li>
				<li><a href="#m07">fadeOut</a></li>
				<li><a href="#m08">initialize</a> <span>static</span></li>
				<li><a href="#m09">isError</a></li>
				<li><a href="#m10">isPlaying</a></li>
				<li><a href="#m11">isReady</a></li>
				<li><a href="#m12">play</a></li>
				<li><a href="#m13">seek</a></li>
				<li><a href="#m14">stop</a></li>
			</ul>

			<b>参数</b>
			<ul class="main__ul--inline">
				<li><a href="#p01">pan</a></li>
				<li><a href="#p02">pitch</a></li>
				<li><a href="#p03">url</a></li>
				<li><a href="#p04">volume</a></li>
			</ul>
		</div><!-- /main__section -->


		<div class="main__section">
			<h2 class="main__title--h2">方法</h2>

			<div id="m01" class="main__subsection">
<pre class="main__pre--code">
addLoadListener ( listner )
</pre>
				<p class="mb10px">Add a callback function that will be called when the audio data is loaded.</p>
				<div class="params">
					<h4>参数：</h4>
					<ul class="params-list">
						<li class="param">
							<code class="param-name">listner</code>
							<span class="type">Function</span>
							<div class="param-description">
								<p>回调函数</p>
							</div>
						</li>
					</ul>
				</div>
			</div><!-- /div -->

			<div id="m02" class="main__subsection">
<pre class="main__pre--code">
addStopListener ( listner )
</pre>
				<p class="mb10px">Add a callback function that will be called when the playback is stopped.</p>
				<div class="params">
					<h4>参数：</h4>
					<ul class="params-list">
						<li class="param">
							<code class="param-name">listner</code>
							<span class="type">Function</span>
							<div class="param-description">
								<p>回调函数</p>
							</div>
						</li>
					</ul>
				</div>
			</div><!-- /div -->

			<div id="m03" class="main__subsection">
<pre class="main__pre--code">
canPlayM4a () <span class="pre__type">Boolean</span> <span class="pre__static">[static]</span>
</pre>
				<p class="mb10px">检测浏览器能否播放 m4a 文件。</p>
				<div class="params">
					<h4>Returns:</h4>
					<p><span class="pre__type">Boolean:</span> <br />
					若浏览器支持播放 m4a 文件，返回 True </p>
				</div>
			</div><!-- /div -->

			<div id="m04" class="main__subsection">
<pre class="main__pre--code">
canPlayOgg () <span class="pre__type">Boolean</span> <span class="pre__static">[static]</span>
</pre>
				<p class="mb10px">检测浏览器能否播放 ogg 文件。</p>
				<div class="params">
					<h4>Returns:</h4>
					<p><span class="pre__type">Boolean:</span> <br />
					若浏览器支持播放 ogg 文件，返回 True </p>
				</div>
			</div><!-- /div -->

			<div id="m05" class="main__subsection">
<pre class="main__pre--code">
clear ()
</pre>
				<p class="mb10px">清除音频数据。</p>
			</div><!-- /div -->

			<div id="m06" class="main__subsection">
<pre class="main__pre--code">
fadeIn ( duration )
</pre>
				<p class="mb10px">淡入音频。</p>
				<div class="params">
					<h4>参数：</h4>
					<ul class="params-list">
						<li class="param">
							<code class="param-name">duration</code>
							<span class="type">Number</span>
							<div class="param-description">
								<p>淡入的时间（秒）</p>
							</div>
						</li>
					</ul>
				</div>
			</div><!-- /div -->

			<div id="m07" class="main__subsection">
<pre class="main__pre--code">
fadeOut ( duration )
</pre>
				<p class="mb10px">淡出音频</p>
				<div class="params">
					<h4>参数：</h4>
					<ul class="params-list">
						<li class="param">
							<code class="param-name">duration</code>
							<span class="type">Number</span>
							<div class="param-description">
								<p>淡出的时间（秒）</p>
							</div>
						</li>
					</ul>
				</div>
			</div><!-- /div -->

			<div id="m08" class="main__subsection">
<pre class="main__pre--code">
initialize ( noAudio ) <span class="pre__type">Boolean</span> <span class="pre__static">[static]</span>
</pre>
				<p class="mb10px">初始化音频系统。</p>
				<div class="params">
					<h4>参数：</h4>
					<ul class="params-list">
						<li class="param">
							<code class="param-name">noAudio</code>
							<span class="type">Boolean</span>
							<div class="param-description">
								<p>无声模式的标志</p>
							</div>
						</li>
					</ul>
					<h4>返回值：</h4>
					<p><span class="pre__type">Boolean:</span> <br />
					若音频系统能够正常使用，返回 True</p>
				</div>
			</div><!-- /div -->

			<div id="m09" class="main__subsection">
<pre class="main__pre--code">
isError () <span class="pre__type">Boolean</span>
</pre>
				<p class="mb10px">检测加载时是否有错误发生。</p>
				<div class="params">
					<h4>Returns:</h4>
					<p><span class="pre__type">Boolean:</span> <br />
					若发生错误，返回 True </p>
				</div>
			</div><!-- /div -->

			<div id="m10" class="main__subsection">
<pre class="main__pre--code">
isPlaying () <span class="pre__type">Boolean</span>
</pre>
				<p class="mb10px">检测音频是否正在播放。</p>
				<div class="params">
					<h4>返回值：</h4>
					<p><span class="pre__type">Boolean:</span> <br />
					若正在播放，返回 True </p>
				</div>
			</div><!-- /div -->

			<div id="m11" class="main__subsection">
<pre class="main__pre--code">
isReady () <span class="pre__type">Boolean</span>
</pre>
				<p class="mb10px">检测音频是否已经可以开始播放。</p>
				<div class="params">
					<h4>返回值：</h4>
					<p><span class="pre__type">Boolean:</span> <br />
					若音频可以开始播放，返回 True </p>
				</div>
			</div><!-- /div -->

			<div id="m12" class="main__subsection">
<pre class="main__pre--code">
play ( loop , offset )
</pre>
				<!-- <p class="mb10px 呵呵">Checks whether the audio data is ready to play.</p> -->
				<p class="mb10px">播放音频。</p>
				<div class="params">
					<h4>参数：</h4>
					<ul class="params-list">
						<li class="param">
							<code class="param-name">loop</code>
							<span class="type">Boolean</span>
							<div class="param-description">
								<p>是否要循环播放</p>
							</div>
						</li>
						<li class="param">
							<code class="param-name">offset</code>
							<span class="type">Number</span>
							<div class="param-description">
								<p>播放开始的时间（秒）</p>
							</div>
						</li>
					</ul>
				</div>
			</div><!-- /div -->

			<div id="m13" class="main__subsection">
<pre class="main__pre--code">
seek ()
</pre>
				<p class="mb10px">获取当前音频的播放位置。</p>
			</div><!-- /div -->

			<div id="m14" class="main__subsection">
<pre class="main__pre--code">
stop ()
</pre>
				<p class="mb10px">停止播放音频。</p>
			</div><!-- /div -->


		</div><!-- /main__section -->


		<div class="main__section">
			<h2 class="main__title--h2">属性</h2>

			<div id="p01" class="main__subsection">
<pre class="main__pre--code">
pan <span class="pre__type">Number</span>
</pre>
				<p class="mb10px">音频的声场位置。</p>
			</div><!-- /div -->

			<div id="p02" class="main__subsection">
<pre class="main__pre--code">
pitch <span class="pre__type">Number</span>
</pre>
				<p class="mb10px">音频的音调。</p>
			</div><!-- /div -->

			<div id="p03" class="main__subsection">
<pre class="main__pre--code">
url <span class="pre__type">String</span>
</pre>
				<p class="mb10px">[只读] 音频文件的地址。</p>
			</div><!-- /div -->

			<div id="p04" class="main__subsection">
<pre class="main__pre--code">
volume <span class="pre__type">Number</span>
</pre>
				<p class="mb10px">音频的音量。</p>
			</div><!-- /div -->

		</div><!-- /main__section -->

	</div><!-- /main -->

</body>
</html>